﻿<UserControl x:Class="Deployment.Data.UI.Controls.Variable.VariablesEditorControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:v="clr-namespace:Deployment.Data.UI.Controls.Variable"
             mc:Ignorable="d" 
             x:Name="Control"
             d:DesignHeight="300" d:DesignWidth="300">
    <DockPanel LastChildFill="True" x:Name="DockPanel" Margin="8">
        <Grid Width="{Binding ElementName=DockPanel, Path=ActualWidth}"
              DockPanel.Dock="Top">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            
            <Label Grid.Row="0" Grid.Column="0"
                   Content="Variables file path:"
                   VerticalAlignment="Center"/>
            
            <TextBlock Grid.Row="0" Grid.Column="1"
                       VerticalAlignment="Center"
                       x:Name="tbl_deploymentfileName"
                       Text="{Binding Path=VariablesFilePath, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}"/>
        </Grid>
        <Button Content="Save changes"
                DockPanel.Dock="Bottom"
                Padding="2"
                IsEnabled="False"
                HorizontalAlignment="Right">
            <Button.Style>
                <Style>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=HasUnsavedChanges}"
                                     Value="True">
                            <Setter Property="Button.IsEnabled" Value="True"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Button.Style>
        </Button>
        <v:EditableVariableList DockPanel.Dock="Top"
                                x:Name="EditableList"
                                />
        
        
    </DockPanel>
</UserControl>
